﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Plane : System.Web.UI.Page
{
    PlaneBusiness pb = new PlaneBusiness();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            bindGV();
        }
    }
    public void bindGV()  
    {
        GridView1.DataSource = pb.getAllPlane();
        GridView1.DataBind();

    }
    protected void btnAddPlane_Click(object sender, EventArgs e)
    {
        Response.Redirect("PlaneEdit.aspx?planeID=0");
    }
    protected void lbDelete_Click(object sender, EventArgs e)
    {
        if (!pb.Delete(int.Parse(((LinkButton)sender).CommandArgument)))
            Label1.Text = "Can't delete";
        Response.Redirect("Plane.aspx");

    }
    protected void lbEdit_Click(object sender, EventArgs e)
    {
        Response.Redirect("PlaneEdit.aspx?planeID=" + ((LinkButton)sender).CommandArgument);
    }
}